<?php Schema::init(); ?>
<div class="schema_wrapper">
	<?php if ($error != -1) { ?>
		<div class="schema_message">
		<?php if (!$error) {
			Backend::infoMessage('User deleted sucsesfuly');
		} else {
			Backend::errorMessage('Error deleting user');
		} ?>
		</div>
	<?php } else { ?>
		<div class="schema_header">
			Delete user "<?php echo $info['name']; ?>"?
		</div>
		<form action="<?php echo CURRENT_URL, $info['id'] . '/' . $group_id; ?>" method="post">
		<?php if (count($group_list) > 0) {?>
			<div><input type="radio" id="delete_from_1" name="delete_from" value="1"<?php if (!$group_id) {?> checked="true"<?php } ?> onclick="$('#delete_info_2').hide();" /> <label for="delete_from_1">Delete completely</label></div>
			<div><input type="radio" id="delete_from_2" name="delete_from" value="2"<?php if ($group_id > 0) {?> checked="true"<?php } ?> onclick="$('#delete_info_2').show();" /> <label for="delete_from_2">Delete from groups</label></div>
			<div id="delete_info_2" style="padding:0px 25px 0px 25px;<?php if (!$group_id) {?> display:none;<?php } ?>">
				<div style="border:1px solid #000;">
				<?php foreach ($group_list as $group) {
					$checked = '';
					if (intval($group_id) == intval($group['id'])) {
						$checked = ' checked="true"';
					} ?>
					<input type="checkbox" name="delete_from_groups[]" value="<?php echo $group['id']; ?>" <?php echo $checked; ?> /> <?php echo $group['name']; ?><br />
				<?php } ?>
				</div>
			</div>
		<?php } else { ?>
			<input type="hidden" name="delete_from" value="1" />
		<?php } ?>
			<div class="schema_buttons">
				<input type="submit" value="Delete" class="schema_submit" />
				<input type="button" value="Cancel" class="schema_button" onclick="history.back()" />
			</div>
		</form>
	<?php } ?>
</div>